<?php

/**
 * BonLivraisonFournisseur form base class.
 *
 * @method BonLivraisonFournisseur getObject() Returns the current form's model object
 *
 * @package    SdCommerce
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseBonLivraisonFournisseurForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                     => new sfWidgetFormInputHidden(),
      'date'                   => new sfWidgetFormDate(),
      'reference'              => new sfWidgetFormInputText(),
      'reference_annee'        => new sfWidgetFormInputText(),
      'lieu_livraison'         => new sfWidgetFormInputText(),
      'observation'            => new sfWidgetFormInputText(),
      'taux_remise'            => new sfWidgetFormInputText(),
      'total_ht'               => new sfWidgetFormInputText(),
      'total_remise'           => new sfWidgetFormInputText(),
      'total_tva'              => new sfWidgetFormInputText(),
      'total_ttc'              => new sfWidgetFormInputText(),
      'rest'                   => new sfWidgetFormInputText(),
      'date_livraison'         => new sfWidgetFormDate(),
      'date_validite'          => new sfWidgetFormDate(),
      'duree_validite'         => new sfWidgetFormInputText(),
      'unite_duree_validate'   => new sfWidgetFormInputText(),
      'cloture'                => new sfWidgetFormInputCheckbox(),
      'livrer'                 => new sfWidgetFormInputCheckbox(),
      'domaine'                => new sfWidgetFormInputCheckbox(),
      'mode_paiement_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ModeReglement'), 'add_empty' => true)),
      'contact_id'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Contact'), 'add_empty' => true)),
      'departement_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'add_empty' => true)),
      'representant_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Representant'), 'add_empty' => true)),
      'taux_escompte'          => new sfWidgetFormInputText(),
      'confirme'               => new sfWidgetFormInputCheckbox(),
      'valider'                => new sfWidgetFormInputCheckbox(),
      'affaire_id'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Affaire'), 'add_empty' => true)),
      'fournisseur_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Fournisseur'), 'add_empty' => true)),
      'brouillon'              => new sfWidgetFormInputCheckbox(),
      'total_fodec'            => new sfWidgetFormInputText(),
      'journal_caisse'         => new sfWidgetFormInputCheckbox(),
      'statut'                 => new sfWidgetFormChoice(array('choices' => array('Reglé' => 'Reglé', 'Non Reglé' => 'Non Reglé', 'Partiellement Reglé' => 'Partiellement Reglé'))),
      'facture_fournisseur_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('FactureFournisseur'), 'add_empty' => true)),
      'created_at'             => new sfWidgetFormDateTime(),
      'updated_at'             => new sfWidgetFormDateTime(),
      'deleted_at'             => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'date'                   => new sfValidatorDate(),
      'reference'              => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'reference_annee'        => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'lieu_livraison'         => new sfValidatorString(array('max_length' => 70, 'required' => false)),
      'observation'            => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'taux_remise'            => new sfValidatorNumber(array('required' => false)),
      'total_ht'               => new sfValidatorNumber(array('required' => false)),
      'total_remise'           => new sfValidatorNumber(array('required' => false)),
      'total_tva'              => new sfValidatorNumber(array('required' => false)),
      'total_ttc'              => new sfValidatorNumber(array('required' => false)),
      'rest'                   => new sfValidatorNumber(array('required' => false)),
      'date_livraison'         => new sfValidatorDate(array('required' => false)),
      'date_validite'          => new sfValidatorDate(array('required' => false)),
      'duree_validite'         => new sfValidatorInteger(array('required' => false)),
      'unite_duree_validate'   => new sfValidatorInteger(array('required' => false)),
      'cloture'                => new sfValidatorBoolean(array('required' => false)),
      'livrer'                 => new sfValidatorBoolean(array('required' => false)),
      'domaine'                => new sfValidatorBoolean(),
      'mode_paiement_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('ModeReglement'), 'required' => false)),
      'contact_id'             => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Contact'), 'required' => false)),
      'departement_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'required' => false)),
      'representant_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Representant'), 'required' => false)),
      'taux_escompte'          => new sfValidatorNumber(array('required' => false)),
      'confirme'               => new sfValidatorBoolean(array('required' => false)),
      'valider'                => new sfValidatorBoolean(array('required' => false)),
      'affaire_id'             => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Affaire'), 'required' => false)),
      'fournisseur_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Fournisseur'), 'required' => false)),
      'brouillon'              => new sfValidatorBoolean(array('required' => false)),
      'total_fodec'            => new sfValidatorNumber(array('required' => false)),
      'journal_caisse'         => new sfValidatorBoolean(array('required' => false)),
      'statut'                 => new sfValidatorChoice(array('choices' => array(0 => 'Reglé', 1 => 'Non Reglé', 2 => 'Partiellement Reglé'), 'required' => false)),
      'facture_fournisseur_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('FactureFournisseur'), 'required' => false)),
      'created_at'             => new sfValidatorDateTime(),
      'updated_at'             => new sfValidatorDateTime(),
      'deleted_at'             => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('bon_livraison_fournisseur[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'BonLivraisonFournisseur';
  }

}
